/*
 * Copyright (c) 2011 Anthony Vandikas
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
 * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, 
 * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software 
 * is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#pragma once

/**
 * Acts as a database of students.
 */
class AbstractStudentList : public QObject
{
	Q_OBJECT

public:
	/**
	 * Virtual destructor for enabling inheritance.
	 */
	virtual ~AbstractStudentList() = 0;

	/**
	 * Repopulates the student list with a new set of values.
	 *
	 * @param values The values to use.
	 */
	virtual void reset(const QList<Student> &values) = 0;

	/**
	 * Sets the password of the student with the specified identifier.
	 *
	 * @param identifier The identifier of the student who's password is to be changed.
	 * @param password The password to set.
	 */
	virtual void setPassword(const QString &identifier, const QString &password) = 0;

	/**
	 * Determines if a student with a specified identifier exists.
	 *
	 * @param identifier The identifier to search for.
	 */
	virtual bool contains(const QString &identifier) const = 0;

	/**
	 * Gets the number of students in the database.
	 */
	virtual int getSize() const = 0;

	/**
	 * Returns the student with the specified identifier.
	 *
	 * @param identifier The identifier of the student to find.
	 */
	virtual Student operator [](const QString &identifier) const = 0;

	/**
	 * Returns the student at the specified index.
	 *
	 * @param index The index of the student to find.
	 */
	virtual Student operator [](int index) const = 0;

signals:
	/**
	 * Emitted when the student list is modified.
	 * This happens when setPassword() or reset() is called.
	 */
	void modified();
};
